public class Test6 {

}
class Singleton {
    private static Singleton instance = new Singleton();
    private Singleton(){

    }
    public static Singleton getInstance(){
        return instance;
    }
}
class SingletonLazy {
    private static volatile SingletonLazy instance = null;

    public SingletonLazy() {
    }

    public  static SingletonLazy getInstance() {
        if(instance == null){
            synchronized (SingletonLazy.class){
                if(instance == null){
                    instance = new SingletonLazy();
                }
            }
        }
        return instance;
    }
}